<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
	<title>Set up an enrich processor | ElasticSearch 7.7 权威指南中文版</title>
	<meta name="keywords" content="ElasticSearch 权威指南中文版, elasticsearch 7, es7, 实时数据分析，实时数据检索" />
    <meta name="description" content="ElasticSearch 权威指南中文版, elasticsearch 7, es7, 实时数据分析，实时数据检索" />
    <!-- Give IE8 a fighting chance -->
    <!--[if lt IE 9]>
    <script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
    <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
    <![endif]-->
	<link rel="stylesheet" type="text/css" href="../static/styles.css" />
	<script>
	var _link = 'enrich-setup.html';
    </script>
</head>
<body>
<div class="main-container">
    <section id="content">
        <div class="content-wrapper">
            <section id="guide" lang="zh_cn">
                <div class="container">
                    <div class="row">
                        <div class="col-xs-12 col-sm-8 col-md-8 guide-section">
                            <div style="color:gray; word-break: break-all; font-size:12px;">原英文版地址: <a href="https://www.elastic.co/guide/en/elasticsearch/reference/7.7/enrich-setup.html" rel="nofollow" target="_blank">https://www.elastic.co/guide/en/elasticsearch/reference/7.7/enrich-setup.html</a>, 原文档版权归 www.elastic.co 所有<br/>本地英文版地址: <a href="../en/enrich-setup.html" rel="nofollow" target="_blank">../en/enrich-setup.html</a></div>
                        <!-- start body -->
                  <div class="page_header">
<strong>重要</strong>: 此版本不会发布额外的bug修复或文档更新。最新信息请参考 <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/index.html" rel="nofollow">当前版本文档</a>。
</div>
<div id="content">
<div class="breadcrumbs">
<span class="breadcrumb-link"><a href="index.html">Elasticsearch Guide [7.7]</a></span>
»
<span class="breadcrumb-link"><a href="ingest.html">Ingest node</a></span>
»
<span class="breadcrumb-link"><a href="ingest-enriching-data.html">Enrich your data</a></span>
»
<span class="breadcrumb-node">Set up an enrich processor</span>
</div>
<div class="navheader">
<span class="prev">
<a href="ingest-enriching-data.html">« Enrich your data</a>
</span>
<span class="next">
<a href="enrich-policy-definition.html">Enrich policy definition »</a>
</span>
</div>
<div class="section xpack">
<div class="titlepage"><div><div>
<h2 class="title">
<a id="enrich-setup"></a>Set up an enrich processor<a class="edit_me edit_me_private" rel="nofollow" title="Editing on GitHub is available to Elastic" href="https://github.com/elastic/elasticsearch/edit/7.7/docs/reference/ingest/enrich.asciidoc">edit</a><a class="xpack_tag" href="https://www.elastic.co/subscriptions"></a>
</h2>
</div></div></div>
<p>To set up an enrich processor, follow these steps:</p>
<div class="olist orderedlist">
<ol class="orderedlist">
<li class="listitem">
Check the <a class="xref" href="enrich-setup.html#enrich-prereqs" title="Prerequisites">prerequisites</a>.
</li>
<li class="listitem">
<a class="xref" href="enrich-setup.html#create-enrich-source-index" title="Add enrich data">Add enrich data</a>.
</li>
<li class="listitem">
<a class="xref" href="enrich-setup.html#create-enrich-policy" title="Create an enrich policy">Create an enrich policy</a>.
</li>
<li class="listitem">
<a class="xref" href="enrich-setup.html#execute-enrich-policy" title="Execute the enrich policy">Execute the enrich policy</a>.
</li>
<li class="listitem">
<a class="xref" href="enrich-setup.html#add-enrich-processor" title="Add an enrich processor to an ingest pipeline">Add an enrich processor to an ingest pipeline</a>.
</li>
<li class="listitem">
<a class="xref" href="enrich-setup.html#ingest-enrich-docs" title="Ingest and enrich documents">Ingest and enrich documents</a>.
</li>
</ol>
</div>
<p>Once you have an enrich processor set up,
you can <a class="xref" href="enrich-setup.html#update-enrich-data" title="Update an enrich index">update your enrich data</a>
and <a class="xref" href="enrich-setup.html#update-enrich-policies" title="Update an enrich policy">update your enrich policies</a>.</p>
<div class="important admon">
<div class="icon"></div>
<div class="admon_content">
<p>The enrich processor performs several operations
and may impact the speed of your <a class="xref" href="pipeline.html" title="Pipeline Definition">ingest pipeline</a>.</p>
<p>We strongly recommend testing and benchmarking your enrich processors
before deploying them in production.</p>
<p>We do not recommend using the enrich processor to append real-time data.
The enrich processor works best with reference data
that doesn’t change frequently.</p>
</div>
</div>
<h4>
<a id="enrich-prereqs"></a>Prerequisites<a class="edit_me edit_me_private" rel="nofollow" title="Editing on GitHub is available to Elastic" href="https://github.com/elastic/elasticsearch/edit/7.7/docs/reference/ingest/enrich.asciidoc">edit</a>
</h4>
<p>If you use Elasticsearch security features, you must have:</p>
<div class="ulist itemizedlist">
<ul class="itemizedlist">
<li class="listitem">
<code class="literal">read</code> index privileges for any indices used
</li>
<li class="listitem">
The <code class="literal">enrich_user</code> <a class="xref" href="built-in-roles.html" title="Built-in roles">built-in role</a>
</li>
</ul>
</div>
<div class="section">
<div class="titlepage"><div><div>
<h3 class="title">
<a id="create-enrich-source-index"></a>Add enrich data<a class="edit_me edit_me_private" rel="nofollow" title="Editing on GitHub is available to Elastic" href="https://github.com/elastic/elasticsearch/edit/7.7/docs/reference/ingest/enrich.asciidoc">edit</a>
</h3>
</div></div></div>
<p>To begin, add documents to one or more source indices. These documents should
contain the enrich data you eventually want to add to incoming documents.</p>
<p>You can manage source indices just like regular Elasticsearch indices using the
<a class="xref" href="docs.html" title="Document APIs">document</a> and <a class="xref" href="indices.html" title="Index APIs">index</a> APIs.</p>
<p>You also can set up <a href="https://www.elastic.co/guide/en/beats/libbeat/7.7/getting-started.html" class="ulink" target="_top">Beats</a>, such as a
<a href="https://www.elastic.co/guide/en/beats/filebeat/7.7/filebeat-getting-started.html" class="ulink" target="_top">Filebeat</a>, to automatically send
and index documents to your source indices. See
<a href="https://www.elastic.co/guide/en/beats/libbeat/7.7/getting-started.html" class="ulink" target="_top">Getting started with Beats</a>.</p>
</div>

<div class="section">
<div class="titlepage"><div><div>
<h3 class="title">
<a id="create-enrich-policy"></a>Create an enrich policy<a class="edit_me edit_me_private" rel="nofollow" title="Editing on GitHub is available to Elastic" href="https://github.com/elastic/elasticsearch/edit/7.7/docs/reference/ingest/enrich.asciidoc">edit</a>
</h3>
</div></div></div>
<p>After adding enrich data to your source indices, you can
<a class="xref" href="enrich-policy-definition.html" title="Enrich policy definition">define an enrich policy</a>. When defining the enrich
policy, you should include at least the following:</p>
<div class="ulist itemizedlist">
<ul class="itemizedlist">
<li class="listitem">
A list of one or more <em>source indices</em> which store enrich data as documents
</li>
<li class="listitem">
The <em>policy type</em> which determines how the processor matches the enrich data
to incoming documents
</li>
<li class="listitem">
A <em>match field</em> from the source indices used to match incoming documents
</li>
<li class="listitem">
<em>Enrich fields</em> containing enrich data from the source indices you want to add
to incoming documents
</li>
</ul>
</div>
<p>You can use this definition to create the enrich policy with the
<a class="xref" href="put-enrich-policy-api.html" title="Put enrich policy API">put enrich policy API</a>.</p>
<div class="warning admon">
<div class="icon"></div>
<div class="admon_content">
<p>Once created, you can’t update or change an enrich policy.
See <a class="xref" href="enrich-setup.html#update-enrich-policies" title="Update an enrich policy">Update an enrich policy</a>.</p>
</div>
</div>
</div>

<div class="section">
<div class="titlepage"><div><div>
<h3 class="title">
<a id="execute-enrich-policy"></a>Execute the enrich policy<a class="edit_me edit_me_private" rel="nofollow" title="Editing on GitHub is available to Elastic" href="https://github.com/elastic/elasticsearch/edit/7.7/docs/reference/ingest/enrich.asciidoc">edit</a>
</h3>
</div></div></div>
<p>Once the enrich policy is created, you can execute it using the
<a class="xref" href="execute-enrich-policy-api.html" title="Execute enrich policy API">execute enrich policy API</a> to create an
<a class="xref" href="ingest-enriching-data.html#enrich-index">enrich index</a>.</p>
<div class="imageblock text-center">
<div class="content">
<img src="../static/images/ingest/enrich/enrich-policy-index.svg" alt="enrich policy index">
</div>
</div>
<p>The <em>enrich index</em> contains documents from the policy’s source indices.
Enrich indices always begin with <code class="literal">.enrich-*</code>,
are read-only,
and are <a class="xref" href="indices-forcemerge.html" title="Force merge API">force merged</a>.</p>
<div class="warning admon">
<div class="icon"></div>
<div class="admon_content">
<p>Enrich indices should be used by the <a class="xref" href="enrich-processor.html" title="Enrich Processor">enrich processor</a> only.
Avoid using enrich indices for other purposes.</p>
</div>
</div>
</div>

<div class="section">
<div class="titlepage"><div><div>
<h3 class="title">
<a id="add-enrich-processor"></a>Add an enrich processor to an ingest pipeline<a class="edit_me edit_me_private" rel="nofollow" title="Editing on GitHub is available to Elastic" href="https://github.com/elastic/elasticsearch/edit/7.7/docs/reference/ingest/enrich.asciidoc">edit</a>
</h3>
</div></div></div>
<p>Once you have source indices, an enrich policy, and the related enrich index in
place, you can set up an ingest pipeline that includes an enrich processor for
your policy.</p>
<div class="imageblock text-center">
<div class="content">
<img src="../static/images/ingest/enrich/enrich-processor.svg" alt="enrich processor">
</div>
</div>
<p>Define an <a class="xref" href="enrich-processor.html" title="Enrich Processor">enrich processor</a> and add it to an ingest
pipeline using the <a class="xref" href="put-pipeline-api.html" title="Put pipeline API">put pipeline API</a>.</p>
<p>When defining the enrich processor, you must include at least the following:</p>
<div class="ulist itemizedlist">
<ul class="itemizedlist">
<li class="listitem">
The enrich policy to use.
</li>
<li class="listitem">
The field used to match incoming documents to the documents in your enrich index.
</li>
<li class="listitem">
The target field to add to incoming documents. This target field contains the
match and enrich fields specified in your enrich policy.
</li>
</ul>
</div>
<p>You also can use the <code class="literal">max_matches</code> option to set the number of enrich documents
an incoming document can match. If set to the default of <code class="literal">1</code>, data is added to
an incoming document’s target field as a JSON object. Otherwise, the data is
added as an array.</p>
<p>See <a class="xref" href="enrich-processor.html" title="Enrich Processor">Enrich Processor</a> for a full list of configuration options.</p>
<p>You also can add other <a class="xref" href="ingest-processors.html" title="Processors">processors</a> to your ingest pipeline.</p>
</div>

<div class="section">
<div class="titlepage"><div><div>
<h3 class="title">
<a id="ingest-enrich-docs"></a>Ingest and enrich documents<a class="edit_me edit_me_private" rel="nofollow" title="Editing on GitHub is available to Elastic" href="https://github.com/elastic/elasticsearch/edit/7.7/docs/reference/ingest/enrich.asciidoc">edit</a>
</h3>
</div></div></div>
<p>You can now use your ingest pipeline to enrich and index documents.</p>
<div class="imageblock text-center">
<div class="content">
<img src="../static/images/ingest/enrich/enrich-process.svg" alt="enrich process">
</div>
</div>
<p>Before implementing the pipeline in production, we recommend indexing a few test
documents first and verifying enrich data was added correctly using the
<a class="xref" href="docs-get.html" title="Get API">get API</a>.</p>
</div>

<div class="section">
<div class="titlepage"><div><div>
<h3 class="title">
<a id="update-enrich-data"></a>Update an enrich index<a class="edit_me edit_me_private" rel="nofollow" title="Editing on GitHub is available to Elastic" href="https://github.com/elastic/elasticsearch/edit/7.7/docs/reference/ingest/enrich.asciidoc">edit</a>
</h3>
</div></div></div>
<p>Once created, you cannot update
or index documents to an enrich index.
Instead, update your source indices
and <a class="xref" href="execute-enrich-policy-api.html" title="Execute enrich policy API">execute</a> the enrich policy again.
This creates a new enrich index from your updated source indices
and deletes the previous enrich index.</p>
<p>If wanted, you can <a class="xref" href="docs-reindex.html" title="Reindex API">reindex</a>
or <a class="xref" href="docs-update-by-query.html" title="Update by query API">update</a> any already ingested documents
using your ingest pipeline.</p>
</div>

<div class="section">
<div class="titlepage"><div><div>
<h3 class="title">
<a id="update-enrich-policies"></a>Update an enrich policy<a class="edit_me edit_me_private" rel="nofollow" title="Editing on GitHub is available to Elastic" href="https://github.com/elastic/elasticsearch/edit/7.7/docs/reference/ingest/enrich.asciidoc">edit</a>
</h3>
</div></div></div>
<p>Once created, you can’t update or change an enrich policy.
Instead, you can:</p>
<div class="olist orderedlist">
<ol class="orderedlist">
<li class="listitem">
Create and <a class="xref" href="execute-enrich-policy-api.html" title="Execute enrich policy API">execute</a> a new enrich policy.
</li>
<li class="listitem">
Replace the previous enrich policy
with the new enrich policy
in any in-use enrich processors.
</li>
<li class="listitem">
Use the <a class="xref" href="delete-enrich-policy-api.html" title="Delete enrich policy API">delete enrich policy</a> API
to delete the previous enrich policy.
</li>
</ol>
</div>
</div>

</div>
<div class="navfooter">
<span class="prev">
<a href="ingest-enriching-data.html">« Enrich your data</a>
</span>
<span class="next">
<a href="enrich-policy-definition.html">Enrich policy definition »</a>
</span>
</div>
</div>

                  <!-- end body -->
                        </div>
                        <div class="col-xs-12 col-sm-4 col-md-4" id="right_col">
                        
                        </div>
                    </div>
                </div>
            </section>
        </div>
    </section>
</div>
<script src="../static/cn.js"></script>
</body>
</html>